package com.hzdesk.media.matvector.koreabatch.client.my_paperless.fragment.Fragment_view;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.hzdesk.media.matvector.koreabatch.client.my_paperless.R;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.fragment.BaseFragment;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.fragment.Fragment_persenter.GuidePageThreeFragmentPersenter;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.fragment.fragment_contract.IGuidePageThreeFragmentContract;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.view.LoginActivity;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.utils.SharedPreferencesUtils;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * Created by Administrator on 2018/8/8.
 */

public class GuidePageThreeFragment extends Fragment implements IGuidePageThreeFragmentContract.IGuidePageThreeFragmentView{
    @BindView(R.id.guide_page_three_iv_cloud)
    ImageView guidePageThreeIvCloud;
    @BindView(R.id.guide_page_three_iv_login)
    ImageView guidePageThreeIvLogin;
    Unbinder unbinder;
    private Context mContext;

    private GuidePageThreeFragmentPersenter guidePageThreeFragmentPersenter=new GuidePageThreeFragmentPersenter(this);


    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mContext = context;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = LayoutInflater.from(mContext).inflate(R.layout.fragment_gudie_page_three, container, false);
        unbinder = ButterKnife.bind(this, view);
        return view;
    }


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    @OnClick({R.id.guide_page_three_iv_cloud, R.id.guide_page_three_iv_login})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.guide_page_three_iv_cloud:
                break;
            case R.id.guide_page_three_iv_login:
                guidePageThreeFragmentPersenter.onCleckedLogin();

                break;
        }
    }

    @Override
    public void toLogin() {
        // desk_media_is_enter_guide_pager  记录是否进入过引导页
        SharedPreferencesUtils.getInstance(mContext).putDate("desk_media_is_enter_guide_pager",true);
        Intent intent =   new Intent(mContext, LoginActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);



    }
}
